import { useState, useEffect, useRef } from 'react';
export default function useCCDebunce(fn, delay = 500) {
  let timer = useRef()
   
  const debounceFn = (...arg) => {
    clearTimeout(timer.current)
    timer.current = setTimeout(() => {
        fn.apply(this, arg)
    }, delay);
    
  }
  return {
    debounceFn,
  }
};